﻿using System;
using System.Collections.Generic;
using System.Text;

namespace OPCDiffCore
{
    [Serializable]
    public class DiffElement
    {
        /// <summary>
        /// Nature of the change.
        /// </summary>
        public DiffType ActionType { get; set; }

        /// <summary>
        /// Nature of the media (text, xml, binary, etc).
        /// </summary>
        public DiffElementType Type { get; set; }

        /// <summary>
        /// Textual description.
        /// </summary>
        public string Description { get; set; }

        /// <summary>
        /// Extra information about the diff (use Type to know the nature of the object).
        /// </summary>
        public object Extra { get; set; }

        internal DiffElement(DiffType actionType, DiffElementType type)
        {
            this.ActionType = actionType;
            this.Type = type;
        }

        internal DiffElement(DiffType actionType, DiffElementType type, string description) :
            this(actionType, type)
        {
            this.Description = description;
        }

        internal DiffElement(DiffType actionType, DiffElementType type, string description, object extra) :
            this(actionType, type, description)
        {
            this.Extra = extra;
        }

        public override string ToString()
        {
            return Type.ToString() + " " + ActionType.ToString() + ": " + Description;
        }
    }
}
